
// 饼图
export default (seriesData, inTxt, per) => {
  let color = '#2f4159'

  if (seriesData.length < 1) {
    seriesData.push({
      name: '',
      value: 0
    })
  } else {
    color = ['#3adab8', '#d1f6ef']
  }
  const { clientWidth:w } = document.body
  return {
    title: {
      text: `${per}%`,
      textAlign: 'center',
      textStyle: {
        color: '#333',
        fontSize: w / 1920 * 30,
        lineHeight: w / 1920 * 20, 
        align: 'right',
        rich: {
          align: 'right'
        }
      },
      subtext: inTxt,
      subtextAlign: 'center',
      subtextStyle: {
        color: '#333',
        fontSize: w / 1920 * 14,
        align: 'right',
        rich: {
          align: 'right'
        }
      },
      y: 'center',
      top: '40%',
      left: '47%'
    },

    color,
    tooltip: {
      trigger: 'item'
    },
    series: [
      {
        name: '',
        type: 'pie',
        radius: ['50%', '70%'],
        // center: ['40%', '50%'],
        avoidLabelOverlap: false,
        label: {
          show: false,
          position: 'center'
        },
        emphasis: {
          label: {
            show: false
          }
        },
        labelLine: {
          show: false
        },
        data: seriesData
      }
    ]
  }
}